Galert = function() {
	this.title = "Alert!",
	
	this.buttonLabels = ["OK"] ,
	
	this.buttonFunctions = ["doNothing()"],
	
	this.image =  "images/info.png",
	
	this.retainProps = false,
	
	this.show = function(alertText){		
		if(alertText){
			if(this.buttonLabels==null || this.buttonFunctions==null) {  
				alert("Button names length and Functions does not match.")  ;
				
				return ;
			}
			else if(this.buttonLabels.length != this.buttonFunctions.length) {
				alert("Button names length and Functions does not match." ) ;
					
				return ;
			}
		}
		else{
			alert("Enter Proper Alert Message");
			
			return ;
		}
	  
		if( this.title == null || this.title == "" ){
			this.title = "Alert!";
		}
			
		if( this.image == null || this.image == "" ){
			this.image = "images/info.png" ;
		}
		
		try{
			// shortcut reference to the document object
			d = document;
			
			// if the modalContainer object already exists in the DOM, bail out.
			if(d.getElementById("modalContainer")) return;
			
			// create the modalContainer div as a child of the BODY element
			mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
			  
			mObj.id = "modalContainer";
			   
			// make sure its as tall as it needs to be to overlay all the content on the page
			mObj.style.height = document.documentElement.scrollHeight + "px";

			// create the DIV that will be the alert 
			alertObj = mObj.appendChild(d.createElement("div"));
			
			alertObj.id = "alertBox"; 

			// MSIE doesnt treat position:fixed correctly, so this compensates for positioning the alert
			if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px";
			  
			// center the alert box
			alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px";
			
			headerContainer = alertObj.appendChild(d.createElement("div"));
			
			headerContainer.id = "headerContainer" ;
			
			hLeft = headerContainer.appendChild(d.createElement("div"));
			
			hLeft.id = "hLeftCorner" ;
			
			hRight = hLeft.appendChild(d.createElement("div"));
			
			hRight.id = "hRightCorner" ; 
			
			hMids = hRight.appendChild(d.createElement("div"));
			
			hMids.id = "hMiddle" ; 
				
			// create an H1 element as the title bar
			h1 = hMids.appendChild(d.createElement("h1"));
			
			h1.appendChild(d.createTextNode(this.title));

			bodyCont = alertObj.appendChild(d.createElement("div"));
			bodyCont.id = "bodyContainer" ;
			bodyCont.style.backgroundImage = "url('"+this.image+"')" ;
			
			// create a paragraph element to contain the txt argument
			msg = bodyCont.appendChild(d.createElement("p"));
			msg.innerHTML = alertText;
				
			btnDiva = bodyCont.appendChild(d.createElement("div"));
			btnDiva.id = "btnDiv" ;
			btnDiva.align= "center" ;

			for(var count=0; count < this.buttonLabels.length; count++){
				btn = btnDiva.appendChild(d.createElement("a"));
				btn.id = this.buttonLabels[count];
				btn.setAttribute("class", "alertButtons");
				btn.appendChild(d.createTextNode(this.buttonLabels[count]));
				
				functionName = this.buttonFunctions[count] ;
				
				btn.href = "javascript:removeCustomAlert();" + functionName + ";" ;
				
				if(count == 0) btn.focus();
			}
				
			d.onkeyup=function(e){
				var e=window.event || e
				
				var keyunicode=e.keyCode? e.keyCode : e.charCode ;
				
				if(keyunicode == 27) removeCustomAlert() ;	
			}
			
		}
		catch(e){
			alert("Galert " + e ) ;
		}	
	};
};
		
function doNothing(){
   // window.status= "Do Nothing function called"  ;
}

// removes the custom alert from the DOM
function removeCustomAlert() {
	if(document.getElementById("modalContainer"))
	
	document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}
